<?php


namespace app\api\controller\v1;


use app\api\controller\BaseController;
use app\services\exam\ExamQuestionImgService;
use think\facade\App;

class QuestionImgCreate extends BaseController
{
    public function __construct(App $app,ExamQuestionImgService  $service)
    {
        parent::__construct($app);
        $this ->services = $service;
    }
    /*
     * 保存学生题目上传图片
     */
    public function index(){
        $where = $this->request->postMore([
            ['exam_id', ''],
            ['question_id',''],
            ['img_url',''],
            ['user_id',''],
        ]);
        return app()->make('json')->successful($this->services->createImg($where));
    }

    /*
     * 查询学生题目上传图片
     */
    public function getImg(){
        $where = $this->request->postMore([
            ['exam_id', ''],
            ['question_id',''],
            ['user_id',''],
        ]);
        return app()->make('json')->successful($this->services->getImg($where));
    }

    /**
     * 查询当前题目
     * @return void
     */
    public function getQuestion(){
        $where = $this->request->postMore([
            ['question_id',''],
        ]);
        return app()->make('json')->successful($this->services->getQuestion($where));
    }
}